package net.monkeybros.sbus;

import com.neurospeech.wsclient.*;

import net.monkeybros.sbus.model.InfoCoche;
import net.monkeybros.sbus.model.InfoHeaderEvent;
import net.monkeybros.sbus.model.InfoVehiculo;
import net.monkeybros.sbus.model.LineStatusInfo;

import org.w3c.dom.*;

public class Dinamica extends SoapWebService{
	
	
	public Dinamica(){
		this.setUrl("/services/dinamica.asmx");
	}
	
	
	public Integer XTIPAdd(String pass, Integer tip, Integer display, String texto) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("XTIPAdd","http://tempuri.org/","http://tempuri.org/XTIPAdd",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "tip",tip);
		addParameter(request, "display",display);
		addParameter(request, "texto",texto);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getInteger(response,null,false);
	}
	
	public Integer TIPAdd(Integer tip, Integer display, String texto) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("TIPAdd","http://tempuri.org/","http://tempuri.org/TIPAdd",null);
		Element request = req.method;
		addParameter(request, "tip",tip);
		addParameter(request, "display",display);
		addParameter(request, "texto",texto);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getInteger(response,null,false);
	}

	public Integer XTIPRemove(String pass, Integer tip, Integer display, Integer id) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("XTIPRemove","http://tempuri.org/","http://tempuri.org/XTIPRemove",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "tip",tip);
		addParameter(request, "display",display);
		addParameter(request, "id",id);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getInteger(response,null,false);
	}
	
	public Integer TIPRemove(Integer tip, Integer display, Integer id) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("TIPRemove","http://tempuri.org/","http://tempuri.org/TIPRemove",null);
		Element request = req.method;
		addParameter(request, "tip",tip);
		addParameter(request, "display",display);
		addParameter(request, "id",id);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getInteger(response,null,false);
	}
	
		public java.util.Vector<InfoVehiculo> XGetVehiculos(String pass, String linea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("XGetVehiculos","http://tempuri.org/","http://tempuri.org/XGetVehiculos",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoVehiculo> retVal = new java.util.Vector<InfoVehiculo>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoVehiculo.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoVehiculo> GetVehiculos(String linea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetVehiculos","http://tempuri.org/","http://tempuri.org/GetVehiculos",null);
		Element request = req.method;
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoVehiculo> retVal = new java.util.Vector<InfoVehiculo>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoVehiculo.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoCoche> XGetCoches(String pass, String linea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("XGetCoches","http://tempuri.org/","http://tempuri.org/XGetCoches",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoCoche> retVal = new java.util.Vector<InfoCoche>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoCoche.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoCoche> GetCoches(String linea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetCoches","http://tempuri.org/","http://tempuri.org/GetCoches",null);
		Element request = req.method;
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoCoche> retVal = new java.util.Vector<InfoCoche>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoCoche.loadFrom(e));
		}
		return retVal;
	}
	
	
	public LineStatusInfo XGetStatusLinea(String pass, String linea) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("XGetStatusLinea","http://tempuri.org/","http://tempuri.org/XGetStatusLinea",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return LineStatusInfo.loadFrom(response);
	}
	
	public LineStatusInfo GetStatusLinea(String linea) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("GetStatusLinea","http://tempuri.org/","http://tempuri.org/GetStatusLinea",null);
		Element request = req.method;
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return LineStatusInfo.loadFrom(response);
	}
	
		
	public java.util.Vector<LineStatusInfo> XGetStatusLineas(String pass, java.util.Vector<String> lineas) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("XGetStatusLineas","http://tempuri.org/","http://tempuri.org/XGetStatusLineas",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		WSHelper.addChildArray(request,"lineas","string",lineas);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<LineStatusInfo> retVal = new java.util.Vector<LineStatusInfo>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(LineStatusInfo.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<LineStatusInfo> GetStatusLineas(java.util.Vector<String> lineas) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetStatusLineas","http://tempuri.org/","http://tempuri.org/GetStatusLineas",null);
		Element request = req.method;
		WSHelper.addChildArray(request,"lineas","string",lineas);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<LineStatusInfo> retVal = new java.util.Vector<LineStatusInfo>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(LineStatusInfo.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoHeaderEvent> XGetEvents(String pass, String linea, Integer sec, Integer parada) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("XGetEvents","http://tempuri.org/","http://tempuri.org/XGetEvents",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "linea",linea);
		addParameter(request, "sec",sec);
		addParameter(request, "parada",parada);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoHeaderEvent> retVal = new java.util.Vector<InfoHeaderEvent>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoHeaderEvent.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoHeaderEvent> GetEvents(String linea, Integer sec, Integer parada) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetEvents","http://tempuri.org/","http://tempuri.org/GetEvents",null);
		Element request = req.method;
		addParameter(request, "linea",linea);
		addParameter(request, "sec",sec);
		addParameter(request, "parada",parada);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoHeaderEvent> retVal = new java.util.Vector<InfoHeaderEvent>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoHeaderEvent.loadFrom(e));
		}
		return retVal;
	}
	
		public void XGetPasoParada(String pass, String linea, String parada, Integer status) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("XGetPasoParada","http://tempuri.org/","http://tempuri.org/XGetPasoParada",null);
		Element request = req.method;
		addParameter(request, "pass",pass);
		addParameter(request, "linea",linea);
		addParameter(request, "parada",parada);
		addParameter(request, "status",status);
		SoapResponse sr = getSoapResponse(req);
	}
	
	public void GetPasoParada(String linea, String parada, Integer status) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("GetPasoParada","http://tempuri.org/","http://tempuri.org/GetPasoParada",null);
		Element request = req.method;
		addParameter(request, "linea",linea);
		addParameter(request, "parada",parada);
		addParameter(request, "status",status);
		SoapResponse sr = getSoapResponse(req);
	}
}
